﻿using B.S.BasicData.Domain.Li;
using B.S.BasicData.ErrorCode;
using B.S.BasicData.Write.Api.Application.Command.L;
using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace B.S.BasicData.Write.Api.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class ProductManageController : ControllerBase
    {
        private readonly IMediator mediator;

        public ProductManageController(IMediator mediator)
        {
            this.mediator = mediator;
        }
        /// <summary>
        /// 获取产品管理列表
        /// </summary>
        /// <param name="command">集合</param>
        /// <returns>返回任务</returns>
        [HttpGet]
        public Task<ApiPaging<ProductManage>> GetProductManage([FromQuery] ProductManageShowCommand command)
        {
            return mediator.Send(command);
        }
        /// <summary>
        /// 产品添加
        /// </summary>
        /// <param name="command">集合</param>
        /// <returns>返回任务</returns>
        [HttpPost]
        public Task<ApiResult<object>> CreateProductManage(ProductManageCreateCommand command)
        {
            return mediator.Send(command);
        }
        /// <summary>
        /// 更新产品
        /// </summary>
        /// <param name="command">集合</param>
        /// <returns>返回任务</returns>
        [HttpPost]
        public Task<ApiResult<object>> UpdateProductManage(ProductManageUpdateCommand command)
        {
            return mediator.Send(command);
        }
    }
}
